package com.hzky.demo.controller;

import com.hzky.demo.dao.HomeworkDao;
import com.hzky.demo.model.Course;
import com.hzky.demo.service.CourseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * Created by admin on 2017/6/7.
 */
@Controller
@Transactional
public class CourseController {

    @Autowired
    CourseService courseService;

    @Autowired
    HomeworkDao homeworkDao;

    @RequestMapping(value = "/courselist/{id}", produces = "application/xhtml+xml;UTF-8")
    String courseManagement(@PathVariable("id")String id, Model model)
    {
        List<Course> courses=courseService.getCourseListByTeacherId(id);
        model.addAttribute("courses",courses);

        return "courselist_15";
    }

}
